<template>
    <!-- <h1>GM添加福利号设备</h1> -->
    <div>
        <div class="app-container">
            <h1>GM添加福利号设备</h1>
            <el-form :inline="true" :model="formInline" class="demo-form-inline" label-width="60px">
                <el-form-item label="UID">
                    <el-input v-model="formInline.user" placeholder="请输入UID"></el-input>
                </el-form-item>
                <el-form-item label="游戏">
                    <el-select v-model="formInline.region" placeholder="请选择游戏">
                    <el-option label="LF" value="lf"></el-option>
                    <el-option label="LS" value="ls"></el-option>
                    <el-option label="ROCS" value="rocs"></el-option>
                    <el-option label="WZ" value="wz"></el-option>
                    </el-select>
                </el-form-item>
                
                <span class="demonstration">    请选择时间  </span>
                <el-date-picker
                    v-model="formInline.time"
                    type="daterange"
                    value-format= timestamp
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
                </el-date-picker>
                

                <el-form-item label="设备ID">
                    <el-input v-model="formInline.devicesid" placeholder="请输入设备ID"></el-input>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" @click="onSelect(formInline)">设备登录信息查询</el-button>
                    <el-button type="primary" @click="onSelect(formInline)">设备绑定信息查询</el-button>
                    <el-button type="primary" @click="onSubmit(formInline)">添加</el-button>
                </el-form-item>
            </el-form>
        </div>

        <div class="app-container">
            <h1>玩家登录信息查询</h1>
            <el-table
            v-loading="listLoading"
            :data="querylist"
            element-loading-text="Loading"
            border
            fit
            highlight-current-row
            >
            <el-table-column prop="uid" align="center" label="ID" width="195"></el-table-column>
            <el-table-column prop="server" align="center" label="服编号" width="95"></el-table-column>
            <el-table-column prop="deviceId" align="center" label="登录的设备ID" width="195"></el-table-column>
            <el-table-column prop="time" align="center" label="登录时间" width="195"></el-table-column>
            <el-table-column prop="model" align="center" label="设备机型" width="195"></el-table-column>
            <el-table-column prop="country.countryName" align="center" label="地区" width="195"></el-table-column>
        </el-table>
        </div>
    </div>
</template>


<script>
import { gmflag, querylogin } from '@/api/gm';
export default {
    data(){
        return{
            formInline: {
                user: '496474915000701',
                region: 'lf',
                devicesid: 'emula_5cafc3e31f7e408e954ab125c1b1a75aLF88',
                time: [new Date().getTime()- 3600 * 1000 * 24 * 7, new Date().getTime()],
            },
            querylist: [
            ],
            
        }
    },
    methods: {
      onSubmit(row) {
        gmflag(row).then(response =>{
            this.$message.success(response.data.msg)
            console.log(response.data.msg);
        })
      },
      onSelect(row){
        querylogin(row).then(response =>{
            this.$message.success(response.data.message)
            this.querylist = response.data.data.list
        })

      },
      
    }
}
</script>